package com.test.mylotterysystem.comment.utils;

import cn.hutool.core.lang.Validator;
import org.springframework.util.StringUtils;

import java.util.regex.Pattern;

public class RegexUtil {

    /**
     * 校验邮箱
     * @param mail
     * @return
     */
    public static boolean checkMailFormat(String mail) {
        return Validator.isEmail(mail);
    }

    /**
     * 校验手机号
     * @param phoneNumber
     * @return
     */
    public static boolean checkPhoneFormat(String phoneNumber) {
        return Validator.isMobile(phoneNumber);
    }

    /**
     * 校验密码
     * @param password
     * @return
     */
    public static boolean checkPasswordFormat(String password){
        String regex= "^[0-9A-Za-z]{6,12}$";
        return Pattern.matches(regex,password);
    }
}
